home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 04 / 4 / DISK0442.ZIP / TIMEDAT4.PAS < prev   
Pascal/Delphi Source File  |  1989-02-08  |  878b  |  33 lines

  1. function clock: TDString;
  2.  
  3. var
  4.   hour,min,sec:         string[2];
  5.   hr,mn,sc,hn:          word;
  6.  
  7. begin
  8.     gettime(hr,mn,sc,hn);
  9.     str(hr,hour);                  {convert to string}
  10.     str(mn,min);                         { " }
  11.     str(sc,sec);                         { " }
  12.       if length(min)=1 then min:='0'+min;
  13.       if length(sec)=1 then sec:='0'+sec;
  14.   clock := hour+':'+min+':'+sec;
  15. end;
  16. function Date: TDString;
  17.  
  18. var
  19.   month,day:     string[2];
  20.   year:          string[4];
  21.   mn,dy,yr,dow:  word;
  22.  
  23. begin
  24.   getdate(yr,mn,dy,dow);
  25.     str(yr,year);                        {convert to string}
  26.     str(dy,day);                             { " }
  27.     str(mn,month);                           { " }
  28.   if length(day)=1 then day:='0'+day;
  29.   if length(month)=1 then month:='0'+month;
  30.   Delete(year,1,2);
  31.   date := month+'/'+day+'/'+year;
  32. end;
  33.